package com.zzx.action;

import com.intellij.ide.util.PropertiesComponent;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.ui.panel.ComponentPanel;
import com.intellij.openapi.ui.panel.ComponentPanelBuilder;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.ToolWindow;

import java.io.File;

public class TextBoxes extends AnAction {
    private static final Logger log =
            Logger.getInstance(TextBoxes.class);
    public void actionPerformed(AnActionEvent event) {
        log.info("启动");

//        PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
//        Project project = event.getData(PlatformDataKeys.PROJECT);
//        String path = Messages.showInputDialog(
//                project,
//                "本地maven仓库的根路径?",
//                "请输入您本地maven仓库的路径",
//                Messages.getQuestionIcon());
//        if(StringUtil.isEmpty(path)){
//            Messages.showDialog(project,"您本地maven仓库的路径未输入，将会导致功能不可用!","错误信息", new String[]{"ok"},0,Messages.getErrorIcon());
//        }else {
//            File file = new File(path);
//            if(!file.exists()||!file.isDirectory()){
//                Messages.showDialog(project,"输入目录不可用!","错误信息", new String[]{"ok"},0,Messages.getErrorIcon());
//            }else {
//                propertiesComponent.setValue("Maven_Repository",path);
//            }
//        }
    }
}
